@extends('admin.layout.index')
@section('js')
<script src="/web/js/libs/jquery-1.8.3.min.js"></script>
<script>
$(function (){
    $('input[name=brandname]').blur(function (){
        val = $(this).val();
        $.get('/ajax/verify','table=shop_brand&list=brandname&brandname='+val, function (msg){
            if(msg == 1){
                $('#text').empty().append('<font style="color:red">品牌名已存在</font>')
            }else{
                $('#text').empty().append('<font style="color:green">品牌名可用</font>')
            }
        },'html')

    })
})
</script>
@endsection
@section('content')
@if (count($errors) > 0)
    <div class="mws-form-message error">
        <ul>
            @foreach ($errors->all() as $error)
                <li>{{ $error }}</li>
            @endforeach
        </ul>
    </div>
@endif
<div class="mws-panel grid_8">
	<div class="mws-panel-header">
    	<span>品牌添加</span>
    </div>
    <div class="mws-panel-body no-padding">
    	<form action="/admin/brand/insert" class="mws-form" method='post' enctype="multipart/form-data">
    		{{csrf_field()}}
    		<div class="mws-form-inline">
    			<div class="mws-form-row">
    				<label class="mws-form-label">品牌名称</label>
    				<div class="mws-form-item">
    					<input type="text" class="small" name="brandname">
                        <span id='text'></span>
    				</div>
    			</div>
                <div class="mws-form-row">
                    <label class="mws-form-label">品牌展示照片</label>
                    <div class="mws-form-item">
                        <input type="file" class="small" name="brandpic">
                    </div>
                </div>
    		</div>
            <div class="mws-form-inline">
                <div class="mws-form-row">
                    <label class="mws-form-label">是否在首页品牌区显示</label>
                    <div class="mws-form-item">
                        <select name="isDisplay" id="">
                            <option value="0">不显示</option>
                            <option value="1">显示</option>
                        </select>
                    </div>
                </div>
            </div>
    		<div class="mws-button-row">
    			<input type="submit" class="btn btn-danger" value="添加">
    			<input type="reset" class="btn " value="重置">
    		</div>
    	</form>
    </div>    	
</div>
@endsection
